package com.anda.record.controller;

import com.anda.model.domain.User2;
import com.anda.model.web.CustomResponse;
import com.anda.record.config.Api;
import com.anda.record.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.websocket.server.PathParam;

/**
 * @author baisongyuan
 * @className UserController
 * @description
 * @date 2022/10/7 17:53
 */
@RestController
@RequestMapping(Api.User.BASE_URL)
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping(Api.User.ONE_USER)
    public CustomResponse oneUserByUsername(@PathVariable("username") String username) {
        User2 user = userService.getUserByUsername(username);
        return CustomResponse.success(user);
    }

}
